# Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
# This source file is part of the Cangjie project, licensed under Apache-2.0
# with Runtime Library Exception.
#
# See https://cangjie-lang.cn/pages/LICENSE for license information.

file(GLOB CJM_SRC *.cpp)
add_definitions(-DCANGJIE_AST2CHIR2)
add_executable(cjm main.cpp ${CJM_SRC})

target_include_directories(cjm PRIVATE ../include)

if(WIN32) # WINDOWS
elseif(APPLE) # APPLE
    set_target_properties(cjm PROPERTIES
        BUILD_RPATH "@loader_path"
        INSTALL_RPATH "@executable_path;@loader_path"
    )
else() # LINUX
    target_link_options(cjm PRIVATE "-Wl,--no-as-needed")
    find_package(Threads REQUIRED)
    target_link_libraries(cjm PRIVATE dl Threads::Threads)
endif()

target_link_libraries(cjm PRIVATE platform)
target_link_libraries(cjm PRIVATE fs_compat)
